--归向真理
local guixiangzhenli = fk.CreateSkill {
    name = "mcdh_guixiangzhenli",
}

local U = require "packages/utility/utility"
local lib = require "packages/mcdh/lib"

guixiangzhenli:addEffect('active',{
    can_use = function(self, player)
        return player:hasSkill(self) and player:getMark("mcdh_ammo") >0
    end,
    target_num = 0,
    min_card_num = 1,
    card_filter = function(self, player,to_select, selected)
        return  not player:prohibitDiscard(Fk:getCardById(to_select))
    end,
    on_use = function(self, room, effect)
        local player = effect.from
        lib.mcdh_ammo(player,-1)
        local cnt = 0 ;
        for _, id in ipairs(effect.cards) do
            cnt = cnt + Fk:getCardById(id).number
        end
        room:throwCard(effect.cards, self.name,player,player)
        if cnt ==7 then
            local tar = room:askToChoosePlayers(player, {
                targets = room.alive_players,
                min_num = 1,
                max_num = 1,
                prompt = "#mcdh_guixiangzhenli-damage",
                skill_name = self.name,
                cancelable = false
              })
            lib.Damage({
                from = player,
                to = tar[1],
                damage = 1,
                skillName = self.name,
            })
        else
            player:drawCards(#effect.cards,self.name)
        end
    end
})

Fk:loadTranslationTable {
    ["mcdh_guixiangzhenli"] = "归向真理",
    [":mcdh_guixiangzhenli"] = "装填技（1），出牌阶段，你可以弃置任意张牌，若点数之和为7，你对一名角色造成1点伤害，否则摸等量张牌",
    ["#mcdh_guixiangzhenli-damage"] = "归向真理:对一名角色造成1点伤害。",
}

return guixiangzhenli